package com.example.school.controller;

import com.example.school.utils.CosHelper;
import com.example.school.utils.JsonResult;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RequestMapping
@RestController
public class OtherController {
    @Operation(summary  = "测试接口")
    @GetMapping("/test")
    public JsonResult Login() {
        return JsonResult.success();
    }


    // 文件上传
    @Operation(summary  = "上传文件")
    @PostMapping("/uploadFile")
    public JsonResult<String> uploadFile(@RequestParam("file") MultipartFile file) {
        String filePath = CosHelper.uploadFile(file);
        return JsonResult.success(filePath);
    }
}